﻿using CSharpWin;
/********************************************
 * 
 *      creat:  Ternence
 * 
 *      time:   2016-03-04
 * 
 *      description:    线程缓冲等待
 * 
 * ******************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;


namespace NF_Base
{
    public static class Wait
    {
        private static Form frmWait = null;

        /// <summary>
        /// 启用等待
        /// </summary>
        public static void WaitStart()
        {
            frmWait = new Form();
            frmWait.ShowIcon = false;
            frmWait.ShowInTaskbar = false;
            frmWait.StartPosition = FormStartPosition.CenterScreen;
            frmWait.TopMost = true;
            frmWait.FormBorderStyle = FormBorderStyle.None;
            frmWait.Width = 80;
            frmWait.Height = 70;
            frmWait.BackColor = Color.White;
            frmWait.TransparencyKey = frmWait.BackColor;

            LoadingProgress lp = new LoadingProgress();
            lp.Style = LoadingProgressStyle.Circle;
            lp.Dock = DockStyle.Fill;
            lp.Start();

            frmWait.Controls.Add(lp);
            frmWait.ShowDialog();
        }

        /// <summary>
        /// 停止等待
        /// </summary>
        public static void WaitStop()
        {
            frmWait.Close();
        }
    }
}
